<?php

namespace Admin\Model;

use Think\Model;

class DictsModel extends Model {

    protected $trueTableName = 'tb_dicts';
    
    public function getFind($where){
        $result = $this->where($where)->find();
        return $result;
    }
    
    public function getList($where){
        $list = $this->where($where)->select();
        return $list;
    }
    
    public function getListPage($where){
        $count = $this->where($where)->count();
        $Page = new \Think\Page($count, 10, $param); // 实例化分页类 传入总记录数和每页显示的记录数
        $list = $this->where($where)->limit($Page->firstRow . ',' . $Page->listRows)->select();
        return array('list' => $list, 'page' => $Page->show(), 'count' => $count);
    }
    
    public function saveData($where,$data){
        $result = $this->where($where)->save($data);
        return $result;
    }
    
    public function addData($data){
        $result = $this->add($data);
        return $result;
    }
    
    public function delData($where){
        $result = $this->where($where)->delete();
        return $result;
    }
    
    public function addDataAll($data){
        $result = $this->addAll($data);
        return $result;
    }
}
